import 'package:star_author/utils/rouces_util.dart';
import 'package:flutter/material.dart';

class StreamLoadingWidget extends StatefulWidget {
  double size;
  StreamLoadingWidget({
    this.size: 44,
  });
  @override
  _LoadingWidgetState createState() => _LoadingWidgetState();
}

class _LoadingWidgetState extends State<StreamLoadingWidget>
    with SingleTickerProviderStateMixin {
  late AnimationController _animationController;

  @override
  void initState() {
    super.initState();
    _animationController = AnimationController(
      vsync: this,
      duration: Duration(seconds: 1),
    )..repeat();
  }

  @override
  void dispose() {
    _animationController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: RotationTransition(
        turns: Tween(begin: 0.0, end: 1.0).animate(_animationController),
        child: RoucesUtil.getAssetsIcon('ic_login_logo', widget.size),
      ),
    );
  }
}
